package com.ruoyi.wcf.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfRotationManage;
import com.ruoyi.wcf.service.IWcfRotationManageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 轮播图管理Controller
 * 
 * @author LCL
 * @date 2022-04-06
 */
@RestController
@RequestMapping("/wcf/WcfRotationManage")
public class WcfRotationManageController extends BaseController
{
    @Autowired
    private IWcfRotationManageService wcfRotationManageService;

    /**
     * 查询轮播图管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfRotationManage wcfRotationManage)
    {
        startPage();
        List<WcfRotationManage> list = wcfRotationManageService.selectWcfRotationManageList(wcfRotationManage);
        return getDataTable(list);
    }

    /**
     * 导出轮播图管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:export')")
    @Log(title = "轮播图管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfRotationManage wcfRotationManage)
    {
        List<WcfRotationManage> list = wcfRotationManageService.selectWcfRotationManageList(wcfRotationManage);
        ExcelUtil<WcfRotationManage> util = new ExcelUtil<WcfRotationManage>(WcfRotationManage.class);
        return util.exportExcel(list, "轮播图管理数据");
    }

    /**
     * 获取轮播图管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:query')")
    @GetMapping(value = "/{rotationId}")
    public AjaxResult getInfo(@PathVariable("rotationId") Long rotationId)
    {
        return AjaxResult.success(wcfRotationManageService.selectWcfRotationManageByRotationId(rotationId));
    }

    /**
     * 新增轮播图管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:add')")
    @Log(title = "轮播图管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfRotationManage wcfRotationManage)
    {
        return toAjax(wcfRotationManageService.insertWcfRotationManage(wcfRotationManage));
    }

    /**
     * 修改轮播图管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:edit')")
    @Log(title = "轮播图管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfRotationManage wcfRotationManage)
    {
        return toAjax(wcfRotationManageService.updateWcfRotationManage(wcfRotationManage));
    }

    /**
     * 删除轮播图管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRotationManage:remove')")
    @Log(title = "轮播图管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{rotationIds}")
    public AjaxResult remove(@PathVariable Long[] rotationIds)
    {
        return toAjax(wcfRotationManageService.deleteWcfRotationManageByRotationIds(rotationIds));
    }
}
